package com.example.commonview;

import androidx.appcompat.app.AppCompatActivity;
import android.widget.Button;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
//实现监听接口

public class MainActivity extends AppCompatActivity {
button button1;
    private View button2;

    @SuppressLint("WrongViewCast")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        button1 = findViewById(R.id.button);
        button2 = findViewById(R.id.button2);
        button2.setOnclickListener(new View.onClickListener());{

        }
    }

    public void click(View view) {
        button1.setText("按钮被点击了");
    }
}